import { createRouter, createWebHashHistory, createWebHistory } from "vue-router"
const router = createRouter({
  // const router =createRouter({})
  // hash模式
  // history:createWebHashHistory(),
  // history模式
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      redirect: "/home",
    },
    {
      name: "home",
      path: "/home",
      component: () => import("../components/Home.vue"),
    },
    {
      name: "foo", // 命名路由
      path: "/foo", // 跳转路劲
      //   组件懒加载
      component: () => import("../components/Foo.vue"),
    },
    {
      name: "demo",
      path: "/demo",
      component: () => import("../components/Demo.vue"),
    },
  ],
})

export default router
